﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SDT.Admin.ViewModels.ArticleCategoryEditViewModel>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Sửa chuyên mục
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%if (ViewData["MessageInfo"] == null)
  { %>
<% using (Html.BeginForm("Edit", "ArticleCategory", FormMethod.Post, new { id = "adminForm" }))
   {%>
    <%= Html.ValidationSummary(true)%>
    
    <fieldset>
        <legend>Sửa chuyên mục</legend>
        <font color="red">*</font> là trường bắt buộc phải nhập.
        <table class="admintable">
            <tbody>
                <tr>
                    <td class="key">
                        Phân mục cha
                    </td>
                    <td>
                        <%=Html.DropDownList("ddlParent", new SelectList(Model.ParrentArticleCatrgories, "ID", "Name", Model.ArticleCategory.ParentID.HasValue?""+Model.ArticleCategory.ParentID.Value:"").ToList(), "-- Chọn phân mục cha--")%>
                    </td>
                </tr>
                <tr>
                    <td class="key">
                        Tên phân mục (<font color="red">*</font>)
                    </td>
                    <td>
                        <%= Html.TextBoxFor(model => model.ArticleCategory.Name, new { @class = "required", style="width:300px" })%>
                    </td>
                </tr>
                <tr>
                    <td class="key">
                        Tên viết tắt (<font color="red">*</font>)
                    </td>
                    <td>
                        <%= Html.TextBoxFor(model => model.ArticleCategory.ShortName, new { @class = "required", style="width:300px" })%>
                    </td>
                </tr> 
                <tr>
                    <td class="key">
                        Độ ưu tiên (<font color="red">*</font>)
                    </td>
                    <td>
                        <%= Html.TextBox("Priority",Model.ArticleCategory.Priority, new { @class = "required", style = "width:60px" })%>
                    </td>
                </tr>
                <tr>
                    <td class="key">Trạng thái kích hoạt</td>
                    <td><%=Html.RadioButton("ArticleCategory.ActiveYN", true, Model.ArticleCategory.ActiveYN == true ? new { @checked = "checked" } : null)%> Kích hoạt
                    <%=Html.RadioButton("ArticleCategory.ActiveYN", false, Model.ArticleCategory.ActiveYN == false ? new { @checked = "checked" } : null)%> Không kích hoạt</td>
                </tr>
                <tr>
                    <td class="key">Mã ngôn ngữ</td>
                    <td>
                       <%=Html.DropDownList("ArticleCategory.LangCode",new SelectList(Model.LanguageCode, "Key", "Value",Model.ArticleCategory.LangCode).ToList(),"-- Chọn ngôn ngữ --", new {@class="required", style = "width:148px" }) %>
                    </td>
                </tr>               
                <tr>
                    <td class="key">
                        Mô tả
                    </td>
                    <td>
                        <%= Html.TextAreaFor(m => m.ArticleCategory.Description, new {rows="10",cols=20,style="width:300px" })%>
                    </td>
                </tr>

            </tbody>
        </table>
        <p>
            <input type="submit" value="Lưu thay đổi" />
        </p>
    </fieldset>
    <% }
  } %>
    
    <script type="text/javascript">
        $(document).ready(function() {
            $("#adminForm").validate({
                rules: {
                    Priority: { required: true, number: true }
                },
                message: {
                    Priority: { required : "This field is require .!.", number: "Character must is number .!."}
                }
            });
        });
        tinyMCE.init({
            mode: "textareas",
            theme: "advanced",
            plugins: "paste,imagemanager",
            theme_advanced_buttons1: "pastetext,separator,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink,insertimage",
            theme_advanced_buttons2: "",
            theme_advanced_buttons3: "",
            theme_advanced_toolbar_location: "top",
            theme_advanced_toolbar_align: "left",
            theme_advanced_statusbar_location: "bottom",
            paste_use_dialog: false,
            paste_auto_cleanup_on_paste: true,
            paste_convert_headers_to_strong: false,
            paste_strip_class_attributes: "all",
            paste_remove_spans: true,
            paste_remove_styles: true
        });

    </script>
    
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Toolbar" runat="server">
    <%= Html.Toolbar("Quay về", "/ArticleCategory/Index/" , "back") %>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Header" runat="server">
    Sửa chuyên mục
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Message" runat="server">
<%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%> 
</asp:Content>
